package com.gxa.admin.controller;

import com.gxa.admin.entity.Orders;
import com.gxa.admin.param.OrderParam;
import com.gxa.admin.service.OrdersService;
import com.gxa.o2o.core.dto.ResultDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.math.BigInteger;

/**
 * 订单表(Orders)表控制层
 *
 * @author makejava
 * @since 2021-07-21 22:57:00
 */
@RestController
@RequestMapping("/admin/orders")
@Api(tags = "后台----订单管理")
public class OrdersController {
    /**
     * 服务对象
     */
    @Resource
    private OrdersService ordersService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    @ApiOperation(value = "通过订单id查询")
    public Orders selectOne(BigInteger id) {
        return this.ordersService.queryById(id);
    }

    /**
     * 通过条件分页查询
     * @param param
     * @return
     */
    @PostMapping("/listByParam")
    @ApiOperation(value = "通过条件分页查询")
    public ResultDTO listByParam(OrderParam param){
        return ordersService.listByParam(param);
    }

}
